//
//  PopExampleImageV.m
//  carcareIOS
//
//  Created by 王然 on 16/8/17.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "PopExampleImageV.h"
@interface PopExampleImageV()

@property (nonatomic , strong) UIImageView * popImageV;

@end
@implementation PopExampleImageV

- (instancetype)init
{
    self = [super initWithFrame:CGRectMake(0, 0, __MAIN_WIDTH, __MAIN_HEIGHT)];
    if (self) {
        self.userInteractionEnabled = YES;
        self.backgroundColor = [UIColor blackColor];
        
        self.popImageV.userInteractionEnabled = YES;
        self.popImageV.center = self.center;
        [self addSubview:self.popImageV];
        
         __weak __typeof(self) wself = self;
        [self addTapSingleAction:^(UITapGestureRecognizer *recognizer) {
            [wself animationHidden:YES];
        }];

    }
    return self;
}
- (UIImageView *)popImageV
{
    if (!_popImageV) {
        UIImage * popImage = ImageNamed(@"vioQuestionPopImage");
        CGFloat imageVW = __MAIN_WIDTH - 50 * __MAIN_RATIO_375;
        _popImageV = [UIImageView imageViewWithFrame:CGRectMake(0, 0, imageVW, imageVW * popImage.size.height / popImage.size.width) image:popImage];
    }
    return _popImageV;
}
- (void)animationHidden:(BOOL)hidden
{
     __weak __typeof(self) wself = self;
    [NSTimer scheduledTimerWithTimeInterval:0.3 block:^{
        [wself setHidden:hidden];
    } repeats:NO];

}
@end
